<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <ul class="lis">
        <li class="li-1">li_1</li>
        <li class="li-2">li_2</li>
        <li class="li-3">li_3</li>
        <li class="li-4">li_4</li>
        <li class="li-5">li_5</li>
    </ul>
    <script>
        var li3 = document.querySelector('.li-3');
        var others = getOtherSiblings(li3);
        console.log(others);


        //查找除了自己以外所有的兄弟节点
        function getOtherSiblings(el){
            // 定义结果集
            var otherLis = [];
            // 1. 先找父亲 ,再通过父亲找到所有的孩子
            var pNode = el.parentNode;
            var childrenLis = pNode.children;
            for(var i = 0 ; i < childrenLis.length ; i ++){
                var li = childrenLis[i];
                // 是否是当前元素 dom元素可以直接做对比
                if(li != el){
                    otherLis.push(li);
                }
            }
            return otherLis;
        }
    </script>
</body>
</html>